package com.common.model.util;

public enum UserType {

	USER(1), ADMIN(10);
	
	private int value;
	
	public static UserType parse(String userType) {
		for (UserType type : values()) {
			if (type.equals(userType)) {
				return type;
			}
		}
		
		return null;
	}
	
	public boolean equalsOrGreater(UserType userType) {
		if (this.equals(userType)) {
			return true;
		}
		
		if (value > userType.getValue()) {
			return true;
		}
		return false;
	}
	
	public boolean equals(String userType) {
		return this.toString().equalsIgnoreCase(userType);
	}
	
	private UserType(int value) {
		this.value = value;
	}
	
	public int getValue() {
		return value;
	}
}
